package com.zwj.controller;

import com.zwj.pojo.DevUser;
import com.zwj.service.ByDevUserService;
import com.zwj.utils.Constants;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class DevController {
    private ByDevUserService byDevUserService;
    @RequestMapping("/dev/login")
    public String logo(){

        return "devlogin";
    }
    @PostMapping("/dev/dologin")
    public String login(String devCode , String devPassword, Model model){
        DevUser logo = byDevUserService.logo(devCode,devPassword);
        if (logo==null){
           model.addAttribute("e","账号密码错误");
           return "devlogin";
        }else {
            model.addAttribute(Constants.DEV_USER_SESSION,logo);
            return "/developer/main";
        }
    }
}
